package com.thekernel.youdaoyun.mapper;

import com.thekernel.youdaoyun.YoudaoyunApplication;
import com.thekernel.youdaoyun.bean.User;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @Author TheKernel
 * @Date 2019/9/22 10:43 上午
 * @Version 1.0
 * @Description 测试 UserMapper
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = YoudaoyunApplication.class)
public class testUserMapper {

    @Autowired
    private UserMapper userMapper;

    @Test
    public void testAdd() {
        // TODO
        User user = new User();
        user.setUsername("test");
        user.setPassword("test");
    }

    @Test
    public void testQueryUserByUserId() {
        long userId = 1;  // 测试用户 id
        User user = this.userMapper.queryUserByUserId(userId);
        System.out.println(user);
        Assert.assertEquals("1711090325", user.getUsername());
    }
}
